//第二次封装，封装一个个请求函数
import http from "@/utils/request2";
export function WenzhanglistRequset(){
  return http({
    url:"/posts",
    method:"get",
  });
}//查看文章列表

export function WenzhangAddRequset(title:string,content:string,status:boolean,){
  return http({
    url:"/posts",
    method:"post",
    data:{
      title,//文章标题
      content,//文章内容
      status,//文章状态
    }
  });
}//发布文章

export function WenzhangPatchRequset(id:number,title:string,content:string,status:boolean,){
  return http({
    url:"/posts/"+id,
    method:"PATCH",
    data:{
      title,
      content,
      status,
    }
  });
}//修改文章

export function WenzhangDeleteRequset(id:number){
  return http({
    url:"/posts/"+id,
    method:"delete",
  });
}//删除文章
export function YonghulistRequset(){
  return http({
    url:"/user",
    method:"get",
  });
}//查看用户列表

export function YonghuAddRequset(username:string,password:string,disabled:boolean){
  return http({
    url:"/user",
    method:"post",
    data:{
      username,//用户名
      password,//密码
      disabled,//是否禁用
    }
  });
}//发布用户

export function YonghuPatchRequset(username:string,password:string,disabled:boolean,id:number){
  return http({
    url:"/user/"+id,
    method:"PATCH",
    data:{
      username,
      password,
      disabled,
    }
  });
}//修改用户

export function YonghuDeleteRequset(id:number){
  return http({
    url:"/user/"+id,
    method:"delete",
  });
}//删除用户

